
class Dashboard::DesignCaseAttachmentsController < Dashboard::BaseController

  before_action :require_logined

  def update
    if params[:image]
      attachment = DesignCaseAttachment.new
      attachment.design_case_id = params[:id]
      attachment.image = params[:image]
      if attachment.save
        design_case = DesignCase.find(params[:id])
        design_case.is_uploaded = true
        design_case.save
        render_success "上传案例成功", image_url: attachment.image_url
      else
        render_fail("您上传的图片格式不支持")
      end
    else
      render_fail("请选择图片后上传")
    end
  end

  def destroy

  end

end
